
	$(function(){
	function setContentSize() {
		$('.gallery-top').css({
			height: $(window).height()-$('.gallery-thumbs').height()
		})
		
	}
	setContentSize()
	$(window).resize(function(){
		setContentSize()
	})

	//Swiper Content
	var contentSwiper = $('.gallery-top').swiper({
		
		autoplay:3000,
		onSlideChangeStart: function(){
			updateNavPosition()
		}
		
		
	})
	 $('.swiper-button-prev').on('click', function(e){
    e.preventDefault()
    contentSwiper.swipePrev()
  })
  $('.swiper-button-next').on('click', function(e){
    e.preventDefault()
    contentSwiper.swipeNext()
  })
	//Nav
	var navSwiper = $('.gallery-thumbs').swiper({
	
		visibilityFullFit: true,
		slidesPerView:'4',
		//Thumbnails Clicks
		onSlideClick: function(){
			contentSwiper.swipeTo( navSwiper.clickedSlideIndex )
		}
	})

	//Update Nav Position
	function updateNavPosition(){
		$('.gallery-thumbs .swiper-slide-active').removeClass('swiper-slide-active')
		var activeNav = $('.gallery-thumbs .swiper-slide').eq(contentSwiper.activeIndex).addClass('swiper-slide-active')
		if (!activeNav.hasClass('swiper-slide-visible')) {
			if (activeNav.index()>navSwiper.activeIndex) {
				var thumbsPerNav = Math.floor(navSwiper.width/activeNav.width())-1
				navSwiper.swipeTo(activeNav.index()-thumbsPerNav)
			}
			else {
				navSwiper.swipeTo(activeNav.index())
			}	
		}
	}
})
	
	
						var klp_flxxtabwwiper = new Swiper('.swiper-containerflxxtabs',{
						speed:500,
						autoplay:3000,
						onSlideChangeStart: function(){
						  $(".tabs .active").removeClass('active')
						  $(".tabs a").eq(klp_flxxtabwwiper.activeIndex).addClass('active')  
						}
					  })
					  $(".tabs a").on('touchstart mousedown',function(e){
						e.preventDefault()
						$(".tabs .active").removeClass('active')
						$(this).addClass('active')
						klp_flxxtabwwiper.swipeTo( $(this).index() )
					  })
					  $(".tabs a").click(function(e){
						e.preventDefault()
					  })
					  

$(document).ready(function(){  
$('a.go').click(function(){ 
$('html, body, .content').animate({scrollTop: $(document).height()}, 900); 
return false; 
}); 
}) 